<?php

/**
 * Represent the reference to a second class and the columns to join on.
 *
 * <p>This mapping contains the reference to a second class
 * and a list of columns to join on.  It is used when fetching
 * dependent classes to:
 * 	1. Retrieve the mapping for the dependent class via its class name.
 *  2. Construct the JOIN condition using data from the owner class.
 */
class Junction_Mapping_Association {
	
	private $_classname;
	
	private $_columns;
	
	public function __construct($classname) {
		$this->_classname = $classname;
		$this->_columns = array();
	}
	
	/**
	 * @return String
	 */
	public function getClassname() {
		return $this->_classname;
	}
	
	/**
	 * @return Iterator over the columns to join on
	 */
	public function getColumns() {
		return new ArrayIterator($this->_columns);
	}
	
	/**
	 * @param String $column
	 */
	public function joinOn($column) {
		$this->_columns[] = $column;
	}
}
?>